From 92ae17547b69e9f9b4a259efb52301e52bf6527a Mon Sep 17 00:00:00 2001 From: robertl Date: Mon, 22 Nov 2004 06:17:26 +0000 Subject: [PATCH] A) We were referenceing shortname after we'd freed it. B) If we were using prefer_shortname and had a description we'd free shortname twice, resulting in a process that would never exit becuase of heap corruption on FC2. (Other OSes would surely have similarly entertaing failure modes.) git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@998 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/csv_util.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/gpsbabel/csv_util.c b/gpsbabel/csv_util.c index 4d426382c..1c55aacd3 100644 --- a/gpsbabel/csv_util.c +++ b/gpsbabel/csv_util.c @@ -856,10 +856,8 @@ xcsv_waypt_pr(const waypoint *wpt) if (description) { xfree(description); } - description = shortname; - } - - if (description) { + description = shortname; + } else if (description) { char *odesc = description; description = str_utf8_to_ascii(odesc); xfree(odesc); @@ -1070,12 +1068,12 @@ xcsv_waypt_pr(const waypoint *wpt) fprintf (xcsv_file.xcsvfp, "%s", xcsv_file.record_delimiter); - if (shortname) - xfree(shortname); - if (description && description != shortname) xfree(description); + if (shortname) + xfree(shortname); + /* increment the index counter */ waypt_out_count++; } -- 2.30.2